
package planner_exercise;

import java.util.ArrayList;
    

public class Stack {
    ArrayList<Object> stackList;
    private Object top;
    private String name;
    Predicates compare;
    public Stack(ArrayList state){
        stackList = state;
    }
    
    public void put(Object pred){
        if(!stackList.isEmpty()){
            stackList.add(pred);
        }
    }
    
    public void takeOut(){
        if(!stackList.isEmpty()){
            stackList.remove(stackList.size()-1);
        }
    } 
    
    public Object seeObject(){
        if(!stackList.isEmpty()){
            top=stackList.get(stackList.size()-1);
        }
        return top;
    }
    public String seeName(){
        if(!stackList.isEmpty()){
            top=stackList.get(stackList.size()-1);
        }
        if(top instanceof Predicates){
            Predicates p= (Predicates)top;
            return p.name;
        }
        return "FAIL";
         
    } 
}
